home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Automatic 229347172001.psc / frmView.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-05-15  |  4.4 KB  |  145 lines

  1. VERSION 5.00
  2. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
  3. Begin VB.Form frmView 
  4.    Caption         =   "View File"
  5.    ClientHeight    =   8595
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   11580
  9.    KeyPreview      =   -1  'True
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   8595
  12.    ScaleWidth      =   11580
  13.    StartUpPosition =   3  'Windows Default
  14.    WindowState     =   2  'Maximized
  15.    Begin RichTextLib.RichTextBox txtSource 
  16.       Height          =   7695
  17.       Left            =   0
  18.       TabIndex        =   0
  19.       Top             =   210
  20.       Width           =   5415
  21.       _ExtentX        =   9551
  22.       _ExtentY        =   13573
  23.       _Version        =   393217
  24.       Enabled         =   -1  'True
  25.       ScrollBars      =   3
  26.       TextRTF         =   $"frmView.frx":0000
  27.    End
  28.    Begin RichTextLib.RichTextBox txtDest 
  29.       Height          =   7695
  30.       Left            =   5610
  31.       TabIndex        =   1
  32.       Top             =   210
  33.       Width           =   6195
  34.       _ExtentX        =   10927
  35.       _ExtentY        =   13573
  36.       _Version        =   393217
  37.       Enabled         =   -1  'True
  38.       ScrollBars      =   3
  39.       TextRTF         =   $"frmView.frx":0090
  40.    End
  41.    Begin VB.Label Label2 
  42.       BackColor       =   &H0080FFFF&
  43.       Caption         =   "Press CTRL+P to print the file"
  44.       ForeColor       =   &H00FF0000&
  45.       Height          =   285
  46.       Left            =   30
  47.       TabIndex        =   4
  48.       Top             =   7950
  49.       Width           =   2295
  50.    End
  51.    Begin VB.Label Label1 
  52.       BackStyle       =   0  'Transparent
  53.       Caption         =   "Source file:"
  54.       ForeColor       =   &H00FF0000&
  55.       Height          =   285
  56.       Index           =   0
  57.       Left            =   30
  58.       TabIndex        =   3
  59.       Top             =   0
  60.       Width           =   945
  61.    End
  62.    Begin VB.Label Label1 
  63.       Caption         =   "Dest file:"
  64.       ForeColor       =   &H00FF0000&
  65.       Height          =   285
  66.       Index           =   1
  67.       Left            =   5640
  68.       TabIndex        =   2
  69.       Top             =   0
  70.       Width           =   945
  71.    End
  72. Attribute VB_Name = "frmView"
  73. Attribute VB_GlobalNameSpace = False
  74. Attribute VB_Creatable = False
  75. Attribute VB_PredeclaredId = True
  76. Attribute VB_Exposed = False
  77. Option Explicit
  78. Public Sub ShowEX(ByVal FilePath As String, Optional ShowInterface As Boolean = False)
  79.     On error goto Err_Proc
  80.     Me.txtSource.Text = ""
  81.     Me.txtDest.Text = ""
  82.     UpdateTextView FilePath, ShowInterface
  83.     If ShowInterface Then
  84.         With Me.txtDest
  85.             .Width = .Left + .Width
  86.             .Left = Me.txtSource.Left
  87.             .ZOrder 0
  88.             Label1(0).Visible = False
  89.             Label1(1).Left = Label1(0).Left
  90.         End With
  91.     End If
  92.     Me.Show
  93. Exit_Proc:
  94.     Exit sub
  95. Err_Proc:
  96.     Err_Handler " frmView ", "ShowEX",Err,Err_Handle_Mode
  97.     Resume Exit_Proc
  98. End Sub
  99. Private Sub UpdateTextView(ByVal sFilePath As String, Optional ByVal ShowInterface As Boolean = False)
  100.     On Error GoTo Err_Proc
  101.     Dim ff          As Long
  102.     Dim s           As String
  103.     Dim sExt        As String
  104.     Dim sView       As String
  105.     sExt = IIf(ShowInterface, ".desc", "")
  106.     ff = FreeFile
  107.     Open sFilePath For Input As #ff
  108.     sView = ""
  109.     Do Until EOF(ff)
  110.         Line Input #ff, s
  111.         sView = sView & s & vbNewLine
  112.     Loop
  113.     Me.txtSource.Text = sView
  114.     Close #ff
  115.     '* Show dest file:
  116.     ff = FreeFile
  117.     sFilePath = GetDestFileName(sFilePath)
  118.     Open App.Path & "\DestTmp\" & sFilePath & sExt For Input As #ff
  119.     sView = ""
  120.     Do Until EOF(ff)
  121.         Line Input #ff, s
  122.         sView = sView & s & vbNewLine
  123.     Loop
  124.     Me.txtDest.Text = sView
  125.     Close #ff
  126. Exit_Proc:
  127. Exit Sub
  128. Err_Proc:
  129.     Err_Handler " frmMain ", "UpdateTextView", Err, Err_Handle_Mode
  130. Resume Exit_Proc
  131. End Sub
  132. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  133.     On error goto Err_Proc
  134.     Select Case KeyCode
  135.         Case vbKeyP And Shift = 2
  136.             Printer.Print Me.txtDest.Text
  137.             Printer.EndDoc
  138.     End Select
  139. Exit_Proc:
  140.     Exit sub
  141. Err_Proc:
  142.     Err_Handler " frmView ", "Form_KeyDown",Err,Err_Handle_Mode
  143.     Resume Exit_Proc
  144. End Sub
  145.